<template>
  <div>
      <el-card style="width: 96%; margin: 20px auto">
        <div class="top"><p class="p1">基础信息</p></div>
        <el-form  label-width="400px" style="margin:10px 0" 
        :rules="rules"
        :model="getList"
        ref="getList"
        class="demo-ruleForm"
       >
        <el-form-item  label-width="400px"  label="平台:" prop="id" >
            <el-input disabled style="width: 611px;" placeholder="双链生鲜供应链平台(p000001)"></el-input>
        </el-form-item>
        <el-form-item label="名称:" prop="name">
            <el-input v-model="getList.name" style="width: 611px;" placeholder="名称"></el-input>
        </el-form-item>
        <el-form-item label="描述:" prop="name">
            <el-input v-model="getList.description" style="width: 611px;" placeholder="描述"></el-input>
        </el-form-item>
        <el-form-item label="产地:" prop="name">
            <el-input v-model="getList.origin" style="width: 611px;" placeholder="产地"></el-input>
        </el-form-item>
        <el-form-item label="备注:" prop="name">
            <el-input v-model="getList.remark" style="width: 611px;" placeholder="备注"></el-input>
        </el-form-item>
        <el-form-item label="品牌:" prop="name">
            <el-input v-model="getList.brand" style="width: 611px;" placeholder="品牌"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="getNew">更新</el-button>
          <el-button type="danger" @click="getack">取消</el-button>
        </el-form-item>
        </el-form>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'Thenew',
  data() {
      return {
    rules: {
        id: [{ required: true, message: "请输入", trigger: "blur" }],
        name: [{ required: true, message: "请输入相关内容", trigger: "blur" }],
      },
      getList:{ 
          name:'',
          brand:'',
          remark:'',
          origin:'',
          description:''
      }
      };
  },
  methods:{ 
    //   点击取消返回首页
    getack(){ 
        this.$emit('getack');
    },
    // 点击提交传递给父组件
    getNew(){ 
        // 内容不能为空
        let { getList }= this;
        if(!getList.name || !getList.brand || !getList.remark || !getList.origin || !getList.description){ 
            this.$message({ 
                message:'请输入完整信息在提交',
                type:'error'
            })
            return
        }
        this.$emit('thenew',getList);
       
    }
  }
}
</script>

<style scoped>

</style>
